#include "..\clientGUI\clientGUI.h"
#include <stdlib.h>
#include "userAI.h"
#include "AdvancedAI.h"
#include "BasicAI.h"
#include "params.h"

namespace AI9 {
	UserAI *userAI = NULL;

	void initAI(GameInfo *game, int user_id) {
		//	use AdvanceAI instead of UserAI
		LOG << "AI9::initAI called" << endl;
		if (params::get<bool>("UseBasicAI", true))
			userAI = new BasicAI(game, user_id);
		else if (params::get<bool>("UseAdvancedAI", true))
			userAI = new AdvanceAI_ns::AdvanceAI(game, user_id);
		else
			userAI = new UserAI(game, user_id);
		LOG << "AI9::initAI done" << endl;
	}

	vector<GeneralType> getPick(int numGeneral, GeneralType yourType, vector<Pair> &pos, vector<SoldierType> &soldierType, vector<int> &numSoldier) {
		LOG << "AI9::getPick called" << endl;
		return userAI->pickGeneral(numGeneral, yourType, pos, soldierType, numSoldier);
	}

	vector <ActionBase *> getAction(GameInfo *game) {
		LOG << "AI9::getAction called" << endl;
		return userAI->getAction(game);
	}

	void deleteAI() {
		delete userAI;
		userAI = NULL;
	}
}

int main(int argc, char *argv[]) {
	params::init();	//	init parameters from params.default
	clientGUImain(argc, argv);
	return 0;
}
